package com.fuchenyang.nacos.config;

import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ConfigurableApplicationContext;

@Slf4j
@SpringBootApplication
//@EnableDiscoveryClient
public class ExampleNacosConfigApplication {
    @SneakyThrows
    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(ExampleNacosConfigApplication.class, args);
        while (true) {
            String id = context.getEnvironment().getProperty("student.id");
            String name = context.getEnvironment().getProperty("student.name");
            log.info("id:{},name:{}", id, name);
            Thread.sleep(2000);
        }
    }
}